package com.wtwd.device.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.wtwd.device.model.dto.DeviceSleepDto;
import com.wtwd.device.model.entity.DeviceHeartRateTotal;
import com.wtwd.device.model.entity.DeviceSleepRecord;
import com.wtwd.device.model.entity.DeviceSleepRecordInfo;
import com.wtwd.device.model.vo.DeviceSleepRecordVo;

import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author mjy
 * @since 2024-05-31
 */
public interface AppDeviceSleepRecordService extends IService<DeviceSleepRecord> {

    /**
     * 睡眠统计数据
     *
     * @param deviceSleepRecord
     * @return
     */
    boolean insertOrUpdate(DeviceSleepRecord deviceSleepRecord);

    /**
     * 获取某一天的睡眠时间
     *
     * @param deviceId
     * @param time
     * @return
     */
    DeviceSleepRecordVo getDayDeviceSleepByTime(Long deviceId, String time);

    /**
     * 根据起始时间查询睡眠信息
     *
     * @param deviceId
     * @param startTime
     * @param endTime
     * @return
     */
    List<DeviceSleepRecordVo> getDaysDeviceSleep(Long deviceId, String startTime, String endTime);

    /**
     * 获取服务器最后一条统计的睡眠信息
     *
     * @param deviceId
     * @return
     */
    DeviceSleepRecord getLastDeviceSleepByDeviceId(Long deviceId);

    /**
     * 同步app的睡眠数据
     *
     * 随眠数据设备一天只上报一次且 只上传给app 获取云端
     *
     * @return
     */
    boolean synchronizationSleep(List<DeviceSleepDto> deviceSleepDtos);


    /**
     * 批量插入或者更新
     *
     * @param deviceSleepRecords
     * @return
     */
    boolean bathInsertOrUpdate(List<DeviceSleepRecord> deviceSleepRecords);
}
